package com.观察者模式.案列2;

import com.google.common.collect.Lists;
import com.观察者模式.案列2.observer.*;
import com.观察者模式.案列2.subject.Subject;
import com.观察者模式.案列2.subject.SubjectImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import java.util.ArrayList;

@Configuration
public class GczFactory {

    @Autowired
    SendMsgToUser sendMsgToUser;

    @Autowired
    ShutdownOrder shutdownOrder;

    @Autowired
    UpdateSkuStock updateSkuStock;

    @Autowired
    UpdateSpuStock updateSpuStock;

    @Autowired
    SubjectImpl subject;

    @PostConstruct
    public void init(){
        ArrayList<ObserverInterface> observerInterfaces = Lists.newArrayList(sendMsgToUser, shutdownOrder, updateSkuStock, updateSpuStock);
        subject.list=observerInterfaces;
    }
}
